/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

import fw.anotations.ClassAnnotationInfo;
import fw.anotations.FieldAnnotationInfo;
import fw.anotations.MethodAnnotationInfo;
import fw.anotations.ParserAnnotation;
import javassist.NotFoundException;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;
import fw.anotations.AnnotationsUtil;
import fw.anotations.AnotacionAtom;
import testes.MiBean;
/**
 *
 * @author HP_Propietario
 */
public class Anotaciones {

    private ParserAnnotation parserAnnotation;

    public Anotaciones() {
    }

    @BeforeClass
    public static void setUpClass() throws Exception {
    }

    @AfterClass
    public static void tearDownClass() throws Exception {
    }

    @Before
    public void setUp() {



    }

    @After
    public void tearDown() {
    }

  //  @Test
    public void parseAnnotationTest() {

        parserAnnotation = new ParserAnnotation();
        parserAnnotation.parse();

        ClassAnnotationInfo annotationInfo = parserAnnotation.parseClassAnnotation();
        assertTrue(annotationInfo instanceof ClassAnnotationInfo);
        FieldAnnotationInfo fieldAnnotationInfo = parserAnnotation.parseFieldAnnotation();
        assertTrue(fieldAnnotationInfo instanceof FieldAnnotationInfo);
        MethodAnnotationInfo methodAnnotationInfo = parserAnnotation.parseMethodAnnotation();
        assertTrue(methodAnnotationInfo instanceof MethodAnnotationInfo);
    }

  //  @Test
    public void  AnnotationUtilTest() throws NotFoundException, ClassNotFoundException{

            AnnotationsUtil.getClassAnnotation(MiBean.class);
            assertTrue(AnnotationsUtil.getClassAnnotation(MiBean.class) instanceof  ClassAnnotationInfo);
            ClassAnnotationInfo classAnnotationInfo=AnnotationsUtil.getClassAnnotation(MiBean.class);
            //classAnnotationInfo.
    }


    @Test
    public void annoationInfoTest() throws NotFoundException, ClassNotFoundException{


           ClassAnnotationInfo classAnnotationInfo=AnnotationsUtil.getClassAnnotation(MiBean.class);
          assertNotNull("la el objeto no existe", classAnnotationInfo);
          classAnnotationInfo.print();

    }

    private void testAnnotation() {

    }
    // TODO add test methods here.
    // The methods must be annotated with annotation @Test. For example:
    //
    // @Test
    // public void hello() {}
}